package ch.sv7.tool.dbmanager.db;

import java.util.ArrayList;

public class Table {

	private String name;

	private ArrayList rows;

	public Table(String name) {
		this.name = name;
		rows = new ArrayList();
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int size() {
		return rows.size();
	}

	public Row getRowAt(int index) {
		return (Row) rows.get(index);
	}

	public void add(Row row) {
		rows.add(row);
	}

	public void clear() {
		rows.clear();
	}

	public String toString() {
		String result = "Table : " + name + "\n";
		for (int i = 0; i < size(); i++)
			result = result + getRowAt(i).toString() + "\n";

		return result;
	}
}
